
using System;
using NUnit.Framework;

namespace Universe.Parallel.Test
{
    [TestFixture]
    public class RangeFor_TestSingle
    {

        [Test]
        public void TestBack()
        {
            Util.IsEquals(new Single[] { 5, 4, 3, 2, 1 }, RangeFor<Single>.Back(5, 1), "RangeFor<Single>.Back(5, 1)");
            Util.IsEquals(new Single[] { 1 }, RangeFor<Single>.Back(1, 1), "RangeFor<Single>.Back(1, 1)");
            Util.IsEquals(new Single[] { }, RangeFor<Single>.Back(1, 5), "RangeFor<Single>.Back(1, 5)");
            Util.IsEquals(new Single[] { Single.MaxValue, }, RangeFor<Single>.Back(Single.MaxValue, Single.MaxValue), "RangeFor<Single>.Back(Single.MaxValue, Single.MaxValue)");
            Util.IsEquals(new Single[] { Single.MinValue, }, RangeFor<Single>.Back(Single.MinValue, Single.MinValue), "RangeFor<Single>.Back(Single.MinValue, Single.MinValue)");
        }

        [Test]
        public void TestCreate()
        {
            Util.IsEquals(new Single[] { Single.MinValue + 3, Single.MinValue + 1 }, RangeFor<Single>.Create(Single.MinValue + 3, Single.MinValue, -2), "RangeFor<Single>.Create(Single.MinValue + 3, Single.MinValue, -2)");
            Util.IsEquals(new Single[] { Single.MaxValue - 3, Single.MaxValue - 1 }, RangeFor<Single>.Create(Single.MaxValue - 3, Single.MaxValue, 2), "RangeFor<Single>.Create(Single.MaxValue - 3, Single.MaxValue, 2)");
            Util.IsEquals(new Single[] { 1 }, RangeFor<Single>.Create(1, 2, 3), "RangeFor<Single>.Create(1, 2, 3)");
            Util.IsEquals(new Single[] { }, RangeFor<Single>.Create(Single.MaxValue, Single.MinValue, 1), "RangeFor<Single>.Create(Single.MaxValue, Single.MinValue, 1)");
            Util.IsEquals(new Single[] { }, RangeFor<Single>.Create(Single.MinValue, Single.MaxValue, -1), "RangeFor<Single>.Create(Single.MinValue, Single.MaxValue, -1)");
            Util.IsEquals(new Single[] { Single.MaxValue }, RangeFor<Single>.Create(Single.MaxValue, Single.MaxValue, 1), "RangeFor<Single>.Create(Single.MaxValue, Single.MaxValue, 1)");
            Util.IsEquals(new Single[] { Single.MinValue }, RangeFor<Single>.Create(Single.MinValue, Single.MinValue, -1), "RangeFor<Single>.Create(Single.MinValue, Single.MinValue, -1)");
        }

        [Test]
        public void TestForward()
        {
            Util.IsEquals(new Single[] { 1 }, RangeFor<Single>.Forward(1, 1), "RangeFor<Single>.Forward(1, 1)");
            Util.IsEquals(new Single[] { 1, 2, 3, 4, 5 }, RangeFor<Single>.Forward(1, 5), "RangeFor<Single>.Forward(1, 5)");
            Util.IsEquals(new Single[] { }, RangeFor<Single>.Forward(5, 1), "RangeFor<Single>.Forward(5, 1)");
            Util.IsEquals(new Single[] { Single.MaxValue }, RangeFor<Single>.Forward(Single.MaxValue, Single.MaxValue), "RangeFor<Single>.Forward(Single.MaxValue, Single.MaxValue)");
            Util.IsEquals(new Single[] { Single.MinValue }, RangeFor<Single>.Forward(Single.MinValue, Single.MinValue), "RangeFor<Single>.Forward(Single.MinValue, Single.MinValue)");
        }

    }
}

